//
// (c)  JAMES T. MACDONALD 2010
// This file is part of the PRODART 2 software
// suite.
//
// Copyright (c) 2010, James T. MacDonald
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
//
// Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
// Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
// Neither the name of the James T. MacDonald nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// For more information please contact by email: j.t.macdonald+prodart@gmail.com
// or visit the sclp (Simple Command Line Parser) project home: http://code.google.com/p/sclp/
//
/*
 * test_options_system.cpp
 *
 *  Created on: 25 Feb 2010
 *      Author: jmacdona
 */

#include <iostream>
#include <fstream>
#include <cmath>
#include <cstring>
#include <exception>
#include "utils/options_store.h"

using std::cout;
using std::endl;
using std::cerr;
using std::ios;
using std::string;
using std::ifstream;
using std::ofstream;
using std::istream;

using namespace PRODART::UTILS;

int main( int argc, char *argv[] ) {

	options_manager opt_mgr;

	opt_mgr.register_option("pose:io:pdb:i", string(""), "input PDB file path" );
        opt_mgr.register_option("pose:io:pdb:r", string(""), "input reference PDB file path" );
        opt_mgr.register_option("pose:io:pdb:o", string(""), "output PDB file path" );
        opt_mgr.register_option("pose:io:pdb:list:l", string(""), "input PDB file list path" );
        opt_mgr.register_option("database", string("./database/"), "database directory path" );
        opt_mgr.register_option("random_seed", (unsigned int)4567856, "database directory path" );

	opt_mgr.list_options_full_format(cout);

	opt_mgr.register_option("say_hello",bool(false),"should I say hello?");
	opt_mgr.register_option("hidden_option",bool(false),"I'm a hidden option", true);

	opt_mgr.set_option_value("pose:io:pdb:i", string("new_path"));

	cout << "\nparsing cmd line" << endl;
	if (opt_mgr.parse_cmd_line(argc, argv)){
		cout << "parsed OK." << endl;
	}
	else {
		cerr << "parsing errors" << endl;
		return -1;
	}

	opt_mgr.list_options_full_format(cout);



	if (opt_mgr.is_set("")){
		//! print flag-less options if they are set
		cout << "\nYou also provided these free options: "
				<< opt_mgr.get_option_value<string>("")
				<< endl;
	}

	if (opt_mgr.get_option_value<bool>("say_hello")){
		cout << "\nI have been told to say hello\n" << endl;
	}

	if (opt_mgr.get_option_value<bool>("hidden_option")){
		cout << "\nYou found me!\n" << endl;
	}

	return 0;
}


